package cn.anlab.anappframe.net.sub2;

import java.io.IOException;
import java.net.InetSocketAddress;

public interface IConnection {

	/**
	 * 连接
	 * @throws IOException
	 */
	public void connect() throws IOException;
	
	/**
	 * 断开连接
	 * @throws IOException
	 */
	public void disconnect() throws IOException;
	
	/**
	 * 判断是否已经连接
	 * @return
	 */
	public boolean isConnected();
	
	/**
	 * 发送数据
	 * @param data
	 * @throws IOException
	 */
	public void send(byte[] data) throws IOException;
	
	
	/**
	 * 设置处理器
	 * @param handler
	 */
	public void setHandler(IHandler handler) ;
	
	/**
	 * 设置服务端地址
	 * @param address
	 */
	public void setAddress(InetSocketAddress address) ;


	
}
